package com.yq.day28;

/**
 * @author 3307235355@qq.com
 * @since 2022/06/28 14:59
 */
public class Demo01 {
    public static void main(String[] args) {

        //每一个窗口里边都有一个新的100
        Sell t1 = new Sell();
        Sell t2 = new Sell();
        Sell t3 = new Sell();
        t1.setName("a窗口");
        t2.setName("b窗口");
        t3.setName("c窗口");

        t1.start();
        t2.start();
        t3.start();

    }
}


class Sell extends Thread {
    int tickets = 100;
    @Override
    public void run() {
        while (true) {
            if (tickets > 0) {
                System.out.println(getName() + "卖了" + (tickets--) + "票");
            }
        }
    }
}